// run: $exec < input
// opt: 0
// flag: -g
// std: c++03
#include <iostream>
#include <algorithm>
#include <vector>

template <class T>
struct point
{
	typedef T value_type;
	point(value_type x, value_type y) : x(x), y(y) {};
	point() {};
	value_type x, y;
	long long index;
};

template <class T>
std::istream & operator>>(std::istream & is, point<T> & a)
{
	is >> a.x >> a.y;
	return is;
}

typedef long long cord_type;
std::vector<point<cord_type> > points;
std::vector<point<cord_type> > stack;

template <class T>
T ccw(point<T> const & a, point<T> const & b, point<T> const & c)
{
	return (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);
}

template <class T>
struct cmp
{
	bool operator()(point<T> const & a, point<T> const & b)
	{
		return a.y < b.y || (a.y == b.y && a.x < b.x);
	}
};

int main()
{
	std::ios::sync_with_stdio(false);

	long long n; std::cin >> n;
	points.resize(n); stack.resize(n + 1);
	for (int i = 0; i < n; i++) {
		std::cin >> points[i];
		points[i].index = i + 1;
	}
	std::sort(points.begin(), points.end(), cmp<long long>());

	int top = 0;
	for (int i = 0; i < n; i++) {
		while (top >= 2 && ccw(stack[top - 2], stack[top - 1], points[i]) < 0)
			top--;
		stack[top++] = points[i];
	}
	int t = top + 1;
	for (int i = n - 2; i >= 0; i--) {
		while (top >= t && ccw(stack[top - 2], stack[top - 1], points[i]) < 0)
			top--;
		stack[top++] = points[i];
	}

	// the perimeter of the convex hull
	long long ans = 1;
	for (int i = 0; i < top - 1; i++)
		ans = (ans * stack[i].index) % (n + 1);
	ans = (ans * (top - 1)) % (n + 1);
	std::cout << ans << '\n';
}

